getDateInfo();

function getDateInfo() {
    $("#date_loading_zone").show();
    $("#date_data_zone").hide();
    $("#date_error_zone").hide();
    var token = getCookie('csrftoken');
    $.ajax({
        // url: '/football/get_platform_info/',
        url: 'http://8.134.215.241:9080/jyb/core/plat/acquirebasedates',
        type: 'POST',
        headers:{'X-CSRFToken': token, "Content-Type": "application/json"},
        data: JSON.stringify({'': ''}),
        success: function(data) {
            let jsonData = data['result'];
            console.log(jsonData);
            let listHtml = "";
            listHtml = listHtml + '<div class="self_common_zone">';
            jsonData.forEach((item, index) => {
                listHtml = listHtml + '<div data-date="' + item + '" onclick="goToPlatformPage(this)" class="self_common_item self_common_item_size_normal self_letter_spacing_2">';
                listHtml = listHtml + '<span>';
                listHtml = listHtml + item;
                listHtml = listHtml + '</span>';
                listHtml = listHtml + '</div>';
            });
            listHtml = listHtml + '</div>';
            $("#date_data_zone").html(listHtml);
            $("#date_loading_zone").hide();
            $("#date_error_zone").hide();
            $("#date_data_zone").show();
        },
        error: function() {
            $("#date_loading_zone").hide();
            $("#date_data_zone").hide();
            $("#date_error_zone").show();
        }
    });
}

function goToPlatformPage(element) {
    const date = element.dataset.date;
    goToOtherPage('./platform.html?date=' + date);
}